/*  REVIEWED_FOR_64BIT=YES  */
//
// Copyright (C) 1991, All Rights Reserved, by
// EMC Corporation, Hopkinton, Mass.
//
// This software is furnished under a license and may be used and copied
// only  in  accordance  with  the  terms  of such  license and with the
// inclusion of the above copyright notice. This software or  any  other
// copies thereof may not be provided or otherwise made available to any
// other person. No title to and ownership of  the  software  is  hereby
// transferred.
//
// The information in this software is subject to change without  notice
// and  should  not be  construed  as  a commitment by EMC Corporation.
//
// EMC assumes no responsibility for the use or  reliability  of its
// software on equipment which is not supplied by EMC.
//

//
// 	RCS Log Removed.  To view log, use: rlog <file>

#ifndef _MEMFRAME_HXX_
#define _MEMFRAME_HXX_

#if !defined(lint) && defined(INCLUDE_RCSID)
/* $Id: memframe.hxx,v 11.14 2010/02/20 00:53:37 williw Exp $ */
/* $Source: /usr/local/cvs/archive/Dart/server/src/kernel/min_kernel/include/memframe.hxx,v $ */
#endif

//
//   class Memory_Frame + dummy implementation
//


#include <m_memfrm.hxx>

class Memory_Frame {
  public:
    // Frame as represented in the frame table for the address-space
    // allocator.

    Memory_Owner getOwner() { return owner; }

    void initBCLink() { linkToBuffer = -1; }

    int getLinkToBuffer() { return linkToBuffer; }

  protected:
    // Memory_Frame must not have a constructor or destructor; they
    // are allocated only in the frame table of the Memory_AddressSpace;
    // owner for each is inititialized by Memory_AddressSpace::startInit();
    // Any other fields must be initialized by the caller of startInit().
    // 
    // Note that there will also be frames for the addresses of any
    // devices that are in the middle of the memory address space.

    // The owner field is managed exclusively by Memory_AddressSpace.
    friend class Memory_AddressSpace;
    // However, the panic dump code also needs (read-only) access.
    friend class DskDump;

	//
	// Note the ordering of these fields to minimize compiler padding.  There
	// is one instance per DART page, so space is at a premium.
	//
    int										linkToBuffer;
    Memory_Owner							owner;
#ifdef CBFS
    short int                                   offset;
#endif
    DQueueLink_unconstructed<Memory_Frame>	link;

    void setProtection(size_t nFrames, Memory_Protection_t);
    // pre:  [this .. this+nFrames] are in bounds
    // post: frames have specified protection

    void initLink();

#ifdef Memory_DEBUG
    void dump();
#endif
};

#ifdef Memory_DEBUG

inline void Memory_Frame::dump()
{
    return;
}
#endif  // Memory_DEBUG

inline void Memory_Frame::initLink()
{
   link.initialize(this);
   linkToBuffer = -1;
}

#endif  // _MEMFRAME_HXX_
